package com.example.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.Service.DigangService;
import com.example.dao.DailyMapper;
import com.example.dao.DigangMapper;
import com.example.pojo.Digang;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DigangServiceImpl extends ServiceImpl<DigangMapper, Digang> implements DigangService {

    @Autowired
    private DigangMapper digangMapper;

    @Override
    public int insert(Digang digang) {  //调岗申请
        return digangMapper.insert(digang);
    }

    public List<Digang> selectAllInD(){
        return digangMapper.selectList(null);  //查询全部 人事
    }

    public int updateSelfAll(Integer id ,Integer status){  //修改状态 人事
        QueryWrapper<Digang> wrapper = new QueryWrapper<>();
        wrapper.eq("id",id);
        Digang digang = digangMapper.selectOne(wrapper);
        digang.setStatus(status);
        return  digangMapper.update(digang,wrapper);
    }

    public List<Digang> selectSelfAllInfo(String name){  //查询自己的列表
        QueryWrapper<Digang> wrapper = new QueryWrapper<>();
        wrapper.eq("name",name);
        return digangMapper.selectList(wrapper);
    }
}
